package com.cxg.fairy.ec.main.sort.content;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.SimpleClickListener;
import com.cxg.fairy.delegates.LatteDelegate;
import com.cxg.fairy.ec.main.search.SearchListDelegate;

/**
 * Created by CFairy
 */

public class ContentItemClickListener extends SimpleClickListener {

    private final LatteDelegate DELEGATE;

    private ContentItemClickListener(LatteDelegate delegate) {
        this.DELEGATE = delegate;
    }

    public static SimpleClickListener create(LatteDelegate delegate) {
        return new ContentItemClickListener(delegate);
    }

    @Override
    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
        final SectionBean sectionBean = (SectionBean) baseQuickAdapter.getData().get(position);
        SectionContentItemEntity scItemEntity = sectionBean.t;
        if(!sectionBean.isMore()){
            final String goodsName = scItemEntity.getGoodsName();
            final SearchListDelegate delegate = SearchListDelegate.create(goodsName);
            DELEGATE.getSupportDelegate().start(delegate);
        }else{

        }

    }

    @Override
    public void onItemLongClick(BaseQuickAdapter adapter, View view, int position) {
    }

    @Override
    public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
    }

    @Override
    public void onItemChildLongClick(BaseQuickAdapter adapter, View view, int position) {
    }
}
